<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      console.log("" + 1 + 0); // "10"， 字符串连接
      console.log("" - 1 + 0); // -1，进行算术运算，""转换为0，
      console.log(true + false); // 1，进行算术运算，true转换为1，false转换为0
      console.log(6 / "3"); // 2, "3" -> 3
      console.log("2" * "3"); // 6, "2" -> 2, "3" -> 3
      console.log(4 + 5 + "px"); // "9px"
      console.log("$" + 4 + 5); // "$45"
      console.log("4" - 2); // 2, "4" -> 4
      console.log("4px" - 2); // NaN , "4px" -> NaN
      console.log("  -9  " + 5); // "  -9  5", 5 -> "5"
      console.log("  -9  " - 5); // -14, "  -9  " -> -9
      console.log(null + 1); // 1, null -> 0
      console.log(undefined + 1); // NaN
      console.log(" \t \n" - 2); // -2, " \t \n" -> 0
      console.log(0 == true); // false, true -> 1
      console.log(1 == true); // true, true -> 1
      console.log(1 === true); // false
      console.log("a" == false); // false , "a"->NaN, false->0
      console.log("" == false); // true
      console.log("" === false); // false
      console.log(undefined == null);
      console.log(undefined === null);
      console.log(!3); // false
      console.log(!!3); // true
      console.log(123 || null || "abc"); // 123 , 123 -> true
      console.log(0 || null || "abc"); // "abc"
      console.log(0 || null || undefined); // undefined
      console.log(123 && null && "abc"); // null
      console.log(0 && null && "abc"); // 0
      console.log(123 && [] && "abc"); // "abc"
      console.log(123 ?? "abc"); // 123
      console.log(null ?? "abc"); // "abc" 空值合并
    </script>
  </body>
</html>
